const Collection = require('../../config/db.config').Collection
const ObjectId = require('mongodb').ObjectId

module.exports = app => {
    const mongoose = app.mongoose
    const date = new Date()
    const FileSchema = mongoose.Schema({
        userId: {
            type: String,
            require: true
        },
        parentId: {
            type: String,
            require: true
        },
        fileName: {
            type: String,
            require: true
        },
        fileId: {type: String},
        fileSize: {type: String},
        fileType: {type: String},
        fileExtension: {
            type: String,
            lowercase: true
        },
        fileUrl: {
            type: String,
            lowercase: true
        },
        fileMultiple: [],
        createTime: {
            type: Number,
            default: date.getTime()
        },
        createLocalTime: {
            type: String,
            default: date.toLocaleString()
        },
    })
    return mongoose.model('File', FileSchema, Collection.FILE_DATA)
}